Skip to content

Conversation

@OzDuys
Copy link

@OzDuys OzDuys commented Aug 28, 2025

What this PR does:
This PR extends the TextArenaEnv class to support non-word-based TextArena games (like Tower of Hanoi) in addition to existing word-based games (like Wordle).

Problem:
The current TextArenaEnv implementation assumes all games have a word_list attribute, causing AttributeError when trying to load puzzle games like Tower of Hanoi that don't use words.

Solution:

  • Added game_kwargs parameter to __init__ to pass game-specific configuration
  • Modified ta_to_hf() method to check if environment has word_list attribute
  • For word-based games: Uses existing logic with word_list
  • For non-word-based games: Creates dataset with empty answers since puzzle games don't have predefined correct answers
  • Updated env_response() to only set secret_word for games that have this concept

Testing:

  • Verified Tower of Hanoi environment loads successfully
  • Existing Wordle functionality remains unchanged
  • Dataset creation works for both game types

Breaking Changes:
None - this is backward compatible with existing word-based games.

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Test improvement

Testing

  • All existing tests pass
  • New tests have been added to cover the changes
  • Tests have been run locally with python -m pytest tests/

Test Coverage

  • Current coverage: ___%
  • Coverage after changes: ___%

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Additional Notes

**What this PR does:**
This PR extends the TextArenaEnv class to support non-word-based TextArena games (like Tower of Hanoi) in addition to existing word-based games (like Wordle).

**Problem:**
The current TextArenaEnv implementation assumes all games have a `word_list` attribute, causing AttributeError when trying to load puzzle games like Tower of Hanoi that don't use words.

**Solution:**
- Added `game_kwargs` parameter to `__init__` to pass game-specific configuration
- Modified `ta_to_hf()` method to check if environment has `word_list` attribute
- For word-based games: Uses existing logic with word_list
- For non-word-based games: Creates dataset with empty answers since puzzle games don't have predefined correct answers
- Updated `env_response()` to only set `secret_word` for games that have this concept

**Testing:**
- Verified Tower of Hanoi environment loads successfully 
- Existing Wordle functionality remains unchanged
- Dataset creation works for both game types

**Breaking Changes:**
None - this is backward compatible with existing word-based games.
@CLAassistant
Copy link

CLAassistant commented Aug 28, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants